<template>
  <van-row class="L-margin-top-10 L-text-align-center">
    <van-col :span="6" v-for="(nitem,nindex) in itemdata.values" :key="nindex" @click="handleClick(nitem)">
      <div>
        <img :src="nitem.icon" style="width: 40px;">
      </div>
      <div class="L-small-text L-margin-top-5 L-margin-bottom-20">{{nitem.stitle}}</div>
    </van-col>
  </van-row>
</template>

<script setup lang="ts">
const props = defineProps({
  itemdata: {
    type: Object,
    default: {},
  },
});
import { useRouter } from "vue-router";
const router = useRouter();
import { useCheck } from "@/hooks/hooks.js";
const { checkCustomized } = useCheck();
import { useRouterStore } from "@/stores/router";
const routerStore = useRouterStore();

function handleClick(item) {
  const path = checkCustomized(`/${item.idobject}`)
    ? item.idobject
    : "/default";
  routerStore.mode = "reload";
  router.push({
    path,
    query: {
      idobject: item.idobject,
      idtemplate: item.idtemplate,
      stitle: item.stitle,
    },
  });
}


</script>

<style scoped>
</style>